package com.kxq.zhuoyue.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kxq.zhuoyue.po.CodeGroup;
import com.kxq.zhuoyue.po.EmpCode;
import com.kxq.zhuoyue.po.Result;

import com.kxq.zhuoyue.service.CodeGroupService;
import com.kxq.zhuoyue.util.result.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/code")
public class CodeGroupController {

    @Autowired
    private CodeGroupService codeGroupService;

    @GetMapping("/selectCodeGroup")
    public AjaxResult findAll(){
        List<CodeGroup> list = codeGroupService.list();
        return AjaxResult.success("查询成功",list);
    }
    @PostMapping("/findByGroupId")
    public AjaxResult findByGroupId(@RequestBody EmpCode empCode){
        QueryWrapper<CodeGroup> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("code_group_id",empCode.getCodeGroupId());
        List<CodeGroup> list = codeGroupService.list(queryWrapper);
        return AjaxResult.success("查询成功",list);
    }

}
